<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>良率分析 - 智能制造分析系统</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../assets/css/all.min.css">
  <!-- AdminLTE -->
  <link rel="stylesheet" href="../assets/css/adminlte.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../assets/css/select2.min.css">
  <link rel="stylesheet" href="../assets/css/select2-bootstrap4.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../assets/css/dataTables.bootstrap4.min.css">
  <!-- Chart.js -->
  <link rel="stylesheet" href="../assets/css/chart.min.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../index.html" class="brand-link">
      <img src="https://adminlte.io/themes/v3/dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">智能制造分析</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <li class="nav-item">
            <a href="dashboard.html" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>生产监控</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="yield-analysis.html" class="nav-link active">
              <i class="nav-icon fas fa-chart-pie"></i>
              <p>良率分析</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="equipment-maintenance.html" class="nav-link">
              <i class="nav-icon fas fa-tools"></i>
              <p>设备维护</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="data-source.html" class="nav-link">
              <i class="nav-icon fas fa-database"></i>
              <p>数据源配置</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="system-settings.html" class="nav-link">
              <i class="nav-icon fas fa-cog"></i>
              <p>系统设置</p>
            </a>
          </li>
          <li class="nav-header">AI功能</li>
          <li class="nav-item">
            <a href="ai/model-management.html" class="nav-link">
              <i class="nav-icon fas fa-brain"></i>
              <p>模型管理</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="ai/prediction-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-line"></i>
              <p>预测分析</p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>良率分析</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">首页</a></li>
              <li class="breadcrumb-item active">良率分析</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- 筛选条件 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">筛选条件</h3>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>产品型号</label>
                      <select class="form-control select2" style="width: 100%;">
                        <option selected="selected">全部</option>
                        <option>产品A</option>
                        <option>产品B</option>
                        <option>产品C</option>
                      </select>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>产线</label>
                      <select class="form-control select2" style="width: 100%;">
                        <option selected="selected">全部</option>
                        <option>A线</option>
                        <option>B线</option>
                        <option>C线</option>
                      </select>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>时间范围</label>
                      <select class="form-control select2" style="width: 100%;">
                        <option selected="selected">今日</option>
                        <option>本周</option>
                        <option>本月</option>
                        <option>自定义</option>
                      </select>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>&nbsp;</label>
                      <button type="button" class="btn btn-primary btn-block">查询</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 良率概览 -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <div class="small-box bg-info">
              <div class="inner">
                <h3>98.5%</h3>
                <p>当前良率</p>
              </div>
              <div class="icon">
                <i class="fas fa-chart-pie"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-success">
              <div class="inner">
                <h3>+0.5%</h3>
                <p>环比提升</p>
              </div>
              <div class="icon">
                <i class="fas fa-arrow-up"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>5</h3>
                <p>异常批次</p>
              </div>
              <div class="icon">
                <i class="fas fa-exclamation-triangle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-danger">
              <div class="inner">
                <h3>2</h3>
                <p>高风险预警</p>
              </div>
              <div class="icon">
                <i class="fas fa-bell"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
        </div>

        <!-- 良率趋势 -->
        <div class="row">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">良率趋势</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="chart">
                  <canvas id="yieldTrendChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
                </div>
              </div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">良率分布</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="chart">
                  <canvas id="yieldDistributionChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 异常分析 -->
        <div class="row">
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">异常原因分析</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="chart">
                  <canvas id="defectAnalysisChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
                </div>
              </div>
            </div>
          </div>
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">异常记录</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body p-0">
                <div class="table-responsive">
                  <table class="table m-0">
                    <thead>
                      <tr>
                        <th>时间</th>
                        <th>批次</th>
                        <th>异常类型</th>
                        <th>影响程度</th>
                        <th>状态</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>10:30</td>
                        <td>B20240315001</td>
                        <td>尺寸偏差</td>
                        <td><span class="badge badge-danger">高</span></td>
                        <td><span class="badge badge-warning">处理中</span></td>
                      </tr>
                      <tr>
                        <td>09:15</td>
                        <td>A20240315002</td>
                        <td>表面缺陷</td>
                        <td><span class="badge badge-warning">中</span></td>
                        <td><span class="badge badge-success">已解决</span></td>
                      </tr>
                      <tr>
                        <td>08:45</td>
                        <td>C20240315003</td>
                        <td>功能异常</td>
                        <td><span class="badge badge-danger">高</span></td>
                        <td><span class="badge badge-warning">处理中</span></td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- AI预测建议 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">AI预测建议</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="alert alert-warning alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-exclamation-triangle"></i> 良率预警!</h5>
                  根据历史数据分析，产品B的良率可能在下午出现下降趋势，建议提前检查相关工艺参数。
                </div>
                <div class="alert alert-info alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-info"></i> 优化建议!</h5>
                  AI分析显示，调整A线温度参数可提升良率0.3%，建议在下一个批次进行参数优化。
                </div>
                <div class="alert alert-success alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-check"></i> 预测结果!</h5>
                  当前生产参数设置合理，预计今日良率将保持在98.5%以上。
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>

  <!-- Main Footer -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2024 <a href="#">智能制造分析系统</a>.</strong> All rights reserved.
  </footer>
</div>

<!-- jQuery -->
<script src="../assets/js/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../assets/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../assets/js/adminlte.min.js"></script>
<!-- Select2 -->
<script src="../assets/js/select2.min.js"></script>
<!-- Chart.js -->
<script src="../assets/js/chart.min.js"></script>

<script>
  $(function () {
    // 初始化Select2
    $('.select2').select2({
      theme: 'bootstrap4'
    });

    // 良率趋势图表
    var yieldTrendCtx = document.getElementById('yieldTrendChart').getContext('2d');
    var yieldTrendChart = new Chart(yieldTrendCtx, {
      type: 'line',
      data: {
        labels: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00'],
        datasets: [{
          label: '实际良率',
          data: [98.2, 98.5, 98.3, 98.7, 98.4, 98.6, 98.5, 98.5],
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        }, {
          label: '目标良率',
          data: [98.5, 98.5, 98.5, 98.5, 98.5, 98.5, 98.5, 98.5],
          borderColor: 'rgb(255, 99, 132)',
          borderDash: [5, 5],
          tension: 0.1
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false,
        scales: {
          y: {
            beginAtZero: false,
            min: 97,
            max: 100
          }
        }
      }
    });

    // 良率分布图表
    var yieldDistributionCtx = document.getElementById('yieldDistributionChart').getContext('2d');
    var yieldDistributionChart = new Chart(yieldDistributionCtx, {
      type: 'doughnut',
      data: {
        labels: ['合格品', '轻微缺陷', '严重缺陷', '报废'],
        datasets: [{
          data: [98.5, 0.8, 0.5, 0.2],
          backgroundColor: [
            'rgb(75, 192, 192)',
            'rgb(255, 205, 86)',
            'rgb(255, 99, 132)',
            'rgb(255, 99, 132)'
          ]
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false
      }
    });

    // 异常原因分析图表
    var defectAnalysisCtx = document.getElementById('defectAnalysisChart').getContext('2d');
    var defectAnalysisChart = new Chart(defectAnalysisCtx, {
      type: 'bar',
      data: {
        labels: ['尺寸偏差', '表面缺陷', '功能异常', '材料问题', '其他'],
        datasets: [{
          label: '缺陷数量',
          data: [35, 25, 20, 15, 5],
          backgroundColor: [
            'rgba(255, 99, 132, 0.5)',
            'rgba(54, 162, 235, 0.5)',
            'rgba(255, 206, 86, 0.5)',
            'rgba(75, 192, 192, 0.5)',
            'rgba(153, 102, 255, 0.5)'
          ],
          borderColor: [
            'rgb(255, 99, 132)',
            'rgb(54, 162, 235)',
            'rgb(255, 206, 86)',
            'rgb(75, 192, 192)',
            'rgb(153, 102, 255)'
          ],
          borderWidth: 1
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false,
        scales: {
          y: {
            beginAtZero: true
          }
        }
      }
    });
  });
</script>
</body>
</html> 